package cn.jly.boot.mp.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * @PackageName cn.jly.boot.mp.bean
 * @ClassName XMemcachedProperties
 * @Description XMemcached配置类
 * @Author 姬岚洋
 * @Date 2021/1/4 下午 7:09
 */
@Component
@ConfigurationProperties(prefix = "memcached")
public class XMemcachedProperties {
    private String servers;
    private int poolSize;
    private long opTimeout;

    public XMemcachedProperties() {
    }

    public String getServers() {
        return servers;
    }

    public void setServers(String servers) {
        this.servers = servers;
    }

    public int getPoolSize() {
        return poolSize;
    }

    public void setPoolSize(int poolSize) {
        this.poolSize = poolSize;
    }

    public long getOpTimeout() {
        return opTimeout;
    }

    public void setOpTimeout(long opTimeout) {
        this.opTimeout = opTimeout;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        XMemcachedProperties that = (XMemcachedProperties) o;
        return poolSize == that.poolSize && opTimeout == that.opTimeout && Objects.equals(servers, that.servers);
    }

    @Override
    public int hashCode() {
        return Objects.hash(servers, poolSize, opTimeout);
    }

    @Override
    public String toString() {
        return "XMemcachedProperties{" +
                "servers='" + servers + '\'' +
                ", poolSize=" + poolSize +
                ", opTimeout=" + opTimeout +
                '}';
    }
}
